<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>添加课程信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">

        <form class="layui-form layuimini-form" action="" lay-filter="example">
            <div class="layui-form-item">
                <label class="layui-form-label required" >课程名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" lay-verify="required" lay-verify="title" autocomplete="off" placeholder="请输入课程名称" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">讲师</label>
                <div class="layui-input-block">
                    <input type="text" name="idCard"  lay-verify="required" placeholder="请输入讲师姓名" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">课时</label>
                <div class="layui-input-block">
                    <input type="text" name="idCard"  lay-verify="required" placeholder="请输入课时" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label required">培训时间</label>
                    <div class="layui-input-block">
                        <input type="text" name="date" id="date1" autocomplete="off" placeholder="请选择培训时间" class="layui-input">
                    </div>
                </div>
            </div>
                <div class="layui-form-item">
                    <label class="layui-form-label required">培训地点</label>
                    <div class="layui-input-block">
                        <input type="text" name="idCard"  lay-verify="required" placeholder="请输入培训地点" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label required">学员人数</label>
                    <div class="layui-input-block">
                        <input type="text" name="idCard"  lay-verify="required" placeholder="请输入学员人数" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label required">岗位类别</label>
                    <div class="layui-input-block">
                        <input type="text" name="idCard"  lay-verify="required" placeholder="质量安全类" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label required">培训形式</label>
                    <div class="layui-input-block">
                        <input type="text" name="idCard"  lay-verify="required" placeholder="外聘" autocomplete="off" class="layui-input">
                    </div>
                </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">培训类型</label>
                <div class="layui-input-block">
                    <select name="interest" lay-filter="aihao">
                        <option value="">-请选择培训类型-</option>
                        <option value="0">写作</option>
                        <option value="1">阅读</option>
                        <option value="2">游戏</option>
                        <option value="3">音乐</option>
                        <option value="4">旅行</option>
                    </select>
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-text">上传照片资料</label>
                <div class="layui-input-block">
                    <input type="text" name="idCard" placeholder="请上传照片资料" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">审核状态</label>
                <div class="layui-input-block">
                    <input type="checkbox" name="close" lay-skin="switch" lay-text="未审核">
                </div>
            </div>
            <div class="layui-form-item">

                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="demo1">确认保存</button>
                    <button class="layui-btn" lay-submit="" lay-filter="demo1">重置</button>
                </div>
            </div>

        </form>

    </div>
</div>

<script src="../../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit;
        var laydate = layui.laydate;

        laydate.render({
            elem: '#date'
        });
        laydate.render({
            elem: '#date1'
        });

        //自定义验证规则
        name.verify({
            username: function (value) {
                if (value.length < 5) {
                    return '标题至少得5个字符啊';
                }
            }
            , pass: [
                /^[\S]{6,12}$/
                , '密码必须6到12位，且不能出现空格'
            ]
            , phone: [
                /^[\d]{11}$/
                , '电话号码为11位'
            ]
        });

        //监听提交
        form.on('submit(demo1)', function (data) {
            layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            })
            return false;
        });

    });
</script>

</body>
</html>